// +FHDR------------------------------------------------------------
//                 Copyright (c) 2022 .
//                       ALL RIGHTS RESERVED
// -----------------------------------------------------------------
// Filename      : pkt_err_case.sv
// Author        : 
// Created On    : 2022-08-25 18:05
// Last Modified : 
// -----------------------------------------------------------------
// Description:
//
//
// -FHDR------------------------------------------------------------

`ifndef __PKT_ERR_CASE_SV__
`define __PKT_ERR_CASE_SV__

class pkt_err_case_spt extends spt_transaction;
    `uvm_object_utils(pkt_err_case_spt)
    function  new(string name= "pkt_err_case_spt");
        super.new(name);
    endfunction 
    constraint pkt_err_case_seq_cons{
        head_err dist {0:/70, 1:/30};
        tail_err dist {0:/70, 1:/30};
        payload_mode dist {0:/10, 1:/20, 2:/50, 3:/20};
    }
endclass

class pkt_err_case_seq extends spt_sequence;

	extern function new(string name = "pkt_err_case_seq");
	extern virtual task body();

	`uvm_object_utils(pkt_err_case_seq)
endclass: pkt_err_case_seq

function pkt_err_case_seq::new(string name = "pkt_err_case_seq");
	super.new(name);
endfunction: new

task pkt_err_case_seq::body();
	repeat(1000) begin
        `uvm_do(spt_tr)
	end
	#100;
endtask: body

class pkt_err_case extends base_test;

	extern function new(string name = "pkt_err_case", uvm_component parent=null);
	extern virtual function void build_phase(uvm_phase phase);
	
	`uvm_component_utils(pkt_err_case)
endclass: pkt_err_case

function pkt_err_case::new(string name = "pkt_err_case", uvm_component parent=null);
    super.new(name, parent);
endfunction: new

function void pkt_err_case::build_phase(uvm_phase phase);
	super.build_phase(phase);
    set_type_override_by_type(spt_transaction::get_type(), pkt_err_case_spt::get_type());
	uvm_config_db #(uvm_object_wrapper)::set(
		this,
		"env.tx_agt.sqr.main_phase",
		"default_sequence",
		pkt_err_case_seq::type_id::get()
	);
endfunction: build_phase

`endif
